<template>  
  <div class="main-body" :style="{'-webkit-overflow-scrolling': scrollMode}">  
    ddd
  </div>  
</template>  
<script>  
  import {Loadmore} from 'mint-ui';  
  export default {  
    data:function() {  
      return {   
        scrollMode:"auto" //移动端弹性滚动效果，touch为弹性滚动，auto是非弹性滚动  
      }  
    },  
    components: {  
      'v-loadmore':Loadmore  // 为组件起别名，vue转换template标签时不会区分大小写，例如：loadMore这种标签转换完就会变成loadmore，容易出现一些匹配问题  
                              // 推荐应用组件时用a-b形式起名  
    },
    beforeCreate() {
      this.isLogin();
    },
    mounted () {
      //this.init("t");
      //this.clearItemStorange("userInfo");
    },
    methods: {
      loadTop () {
        this.init("t");
      },
      loadBottom () {
        console.log(this.total);
        if(this.total > 5) {
          this.init("b");
        }
      },
      pageListLen () {
        let len = this.pageList;
        if(len === undefined) {
          return 1;
        } else {
          return this.pageList.length;
        }  
      },
      init(type) {
        let me = this;
        setTimeout(function () {
          console.log(111);
          if(type === "t") {
            me.pageList = [];
          }
          for(var i = me.total; i < me.total + 50; i++) {
            me.pageList.push(i);
            console.log(i);
          };
          me.total = me.pageListLen();
          if(type === "t") {
            me.$refs.loadmore.onTopLoaded();
          } else if(type === "b") {
            me.$refs.loadmore.onBottomLoaded();
          }
        }, 1500);
      }
    }
  }  
</script>

<style scoped lang="less">
</style>